# Python位置参数
## 实参和形参数量必须一致
def girth(width, height):
    return 2 * (width + height)

# 调用函数时，必须传递 2 个参数，否则会引发错误
#print(girth(3)) # TypeError: girth() missing 1 required positional argument: 'height'
# 同样，多传参数也会抛异常：
#print(girth(3, 2, 4)) # TypeError: girth() takes 2 positional arguments but 3 were given

## 实参和形参位置必须一致
def area(height, width):
    return height * width / 2

#print(area("C语言中文网", 3)) # TypeError: unsupported operand type(s) for /: 'str' and 'int'
def area(upper_base, lower_bottom, height):
    return (upper_base + lower_bottom) * height / 2

print("正确结果为：", area(4, 3, 5))
print("错误结果为：", area(4, 5, 3))

